import request from './axios'

// 获取验证码
export function getCaptchaReq(data: any) {
  return request({
    url: '/user/captcha',
    method: 'post',
    data,
  })
}

// 获取验证码,修改用户信息
export function updateInfoCaptchaReq(data: any) {
  return request({
    url: '/user/updateInfoCaptcha',
    method: 'post',
    data,
  })
}

// 修改用户信息
export function updateUserInfoReq(data: any) {
  return request({
    url: '/user/updateUserInfo',
    method: 'post',
    data,
  })
}

// 注册新用户
export function registerReq(data: any) {
  return request({
    url: '/user/register',
    method: 'post',
    data,
  })
}

// 登录
export function loginReq(data: any) {
  return request({
    url: '/user/login',
    method: 'post',
    data,
  })
}

// 更新密码
export function updatePassReq(data: any) {
  return request({
    url: '/user/updatePass',
    method: 'post',
    data,
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/user/getUserInfo',
    method: 'get',
  })
}

// 获取用户列表
export function getUsersReq() {
  return request({
    url: '/user/findMany',
    method: 'get',
  })
}

// 冻结用户
export function frozenUserReq(data: any) {
  return request({
    url: '/user/frozenUser',
    method: 'post',
    data,
  })
}

// 创建分类
export function createMainlyCategoryReq(data: any) {
  return request({
    url: '/mainly-category/create',
    method: 'post',
    data,
  })
}

// 编辑分类
export function editMainlyCategoryReq(data: any) {
  return request({
    url: '/mainly-category/edit',
    method: 'post',
    data,
  })
}

// 编辑分类
export function deleteMainlyCategoryReq(data: any) {
  return request({
    url: '/mainly-category/delete',
    method: 'post',
    data,
  })
}

// 查找用户的分类
export function findUserCategoryReq(data: any) {
  return request({
    url: '/mainly-category/userAll',
    method: 'post',
    data,
  })
}

// 创建角色
export function createRoleReq(data: any) {
  return request({
    url: '/role/create',
    method: 'post',
    data,
  })
}

// 获取角色列表
export function getRoleListReq() {
  return request({
    url: '/role/findMany',
    method: 'get',
  })
}

// 编辑角色
export function editRoleReq(data: any) {
  return request({
    url: '/role/update',
    method: 'post',
    data,
  })
}

// 删除角色
export function deleteRoleReq(data: any) {
  return request({
    url: '/role/delete',
    method: 'post',
    data,
  })
}

// 添加权限
export function createPermissionReq(data: any) {
  return request({
    url: '/permission/create',
    method: 'post',
    data,
  })
}

// 获取权限列表
export function getPermissionListReq() {
  return request({
    url: '/permission/findMany',
    method: 'get',
  })
}

// 编辑权限
export function editPermissionReq(data: any) {
  return request({
    url: '/permission/update',
    method: 'post',
    data,
  })
}

// 删除权限
export function deletePermissionReq(data: any) {
  return request({
    url: '/permission/delete',
    method: 'post',
    data,
  })
}

// 编辑用户角色
export function editUserRolesReq(data: any) {
  return request({
    url: '/user/editUserRoles',
    method: 'post',
    data,
  })
}

// 查找子分类
export function findSubCategoryReq(data: any) {
  return request({
    url: '/sub-category/findSubAll',
    method: 'post',
    data,
  })
}

// 创建文档分类
export function createSubCategoryReq(data: any) {
  return request({
    url: '/sub-category/create',
    method: 'post',
    data,
  })
}

// 编辑文档分类
export function editSubCategoryReq(data: any) {
  return request({
    url: '/sub-category/edit',
    method: 'post',
    data,
  })
}

// 删除文档分类
export function deleteSubCategoryReq(data: any) {
  return request({
    url: '/sub-category/delete',
    method: 'post',
    data,
  })
}

// 创建文章
export function createArticleReq(data: any) {
  return request({
    url: '/article/create',
    method: 'post',
    data,
  })
}

// 获取文章列表
export function getArticleListReq(data: any) {
  return request({
    url: '/article/findMany',
    method: 'post',
    data,
  })
}

// 获取重点文章列表
export function getKeyArticleListReq(data: any) {
  return request({
    url: '/article/findKeyArticle',
    method: 'post',
    data,
  })
}

// 编辑文章
export function editArticleReq(data: any) {
  return request({
    url: '/article/edit',
    method: 'post',
    data,
  })
}

// 删除文章
export function deleteArticleReq(data: any) {
  return request({
    url: '/article/delete',
    method: 'post',
    data,
  })
}

// 上传单个文件
export function uploadSingleFileReq(data: any) {
  return request({
    url: '/article/uploadSingleFile',
    method: 'post',
    data,
  })
}